<template>
    <view class="pickup-list-item" @click="chooseDepository()">
        <text class="pickup-name">{{ data.repositoryName }}</text>
        <text class="pickup-address">{{ data.address }}</text>
        <view class="action-bar">
            <view class="action-item" @click.stop="gotoMap">
                <text class="text-icon icon-pickup-lbs"></text>
                <text>导航</text>
            </view>
            <view class="action-item" @click.stop="makePhoneCall(data.linkPhone)">
                <text class="text-icon icon-pickup-tel"></text>
                <text>电话</text>
            </view>
        </view>
    </view>
</template>
<script>
import { toMapAPP } from "@/uni-sub-base/utils/mapUtil"
export default {
    props: {
        data: {
            type: Object,
            default: function () {
                return {}
            },
        },
    },
    data() {
        return {}
    },
    computed: {},
    mounted() {},
    methods: {
        chooseDepository(data) {
            this.$emit("chooseDepository", data)
        },
        gotoMap() {
            //#ifdef APP-PLUS
            let lat = 0,
                lng = 0,
                name = ""
            lat = this.data.latitude
            lng = this.data.longitude
            name = this.data.repositoryName
            console.log(lat, lng, name)
            toMapAPP(lat, lng, name)
            // #endif
            // #ifndef APP-PLUS
            this.easyToast("请在app中使用导航功能")
            //#endif
        },
    },
}
</script>

<style lang="scss" scoped>
.pickup-list-item {
    &:not(:first-child) {
        margin-top: $app-page-padding;
    }
    padding: $app-page-padding $app-page-padding 0;
    background: $color-white;
    border-radius: 16rpx;
    display: flex;
    flex-direction: column;
    .pickup-name {
        font-size: $font-size-36;
        font-weight: bold;
        margin-bottom: 12rpx;
    }

    .pickup-address {
        font-size: $font-size-28;
        color: $app-color-text-desc;
    }

    .action-bar {
        display: flex;
        flex-direction: row;
        border-top: solid 1rpx $border;
        padding: $app-page-padding 0;
        margin-top: 22rpx;
        .action-item {
            border-right: solid 2rpx #b9c0d0;
            flex: 1;
            display: flex;
            flex-direction: row;
            justify-content: center;
            align-items: center;
            &:last-child {
                border-right: 0;
            }
            .text-icon {
                width: 40rpx;
                height: 40rpx;
                margin-right: 12rpx;
            }
        }
    }
}

.icon-pickup-lbs {
    background-image: url(../../static/icon/icon-pickup-lbs.png);
}

.icon-pickup-tel {
    background-image: url(../../static/icon/icon-pickup-tel.png);
}
</style>
